UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Z9OSyx18j5KqQapw+IbJCoztOCRJZG6LnO0I7zQu+c='
WHERE
key_id = '80de7e3481b3059d70085b608110df819b1cc02a51401a566aa8337ea2b972dd'
AND (
token = '4Z9OSyx18j5KqQapw+IbJCoztOCRJZG6LnO0I7zQu+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)