UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aU0535NAi+6RT9QO4TygMSYSY0EGI8zrTG4lKJ8UOSs='
WHERE
key_id = 'd1b17f2ae6491180dbe570be6c6bea3a9f8daf77d828c59247dada75a705644e'
AND (
token = 'aU0535NAi+6RT9QO4TygMSYSY0EGI8zrTG4lKJ8UOSs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)