UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gldKCjiUE1xK5GmWgIRUmrfa/6hRuY6xGhu63T+hIsA='
WHERE
key_id = '24e6c6fdf5ae53365b02d8745855f6d9975c28541449c53b9c24590431d8b95a'
AND (
token = 'gldKCjiUE1xK5GmWgIRUmrfa/6hRuY6xGhu63T+hIsA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)