UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kmHelrY4yIFsY8/DcIn/xj4OkfmpeU7An87jJ1+jHSI='
WHERE
key_id = 'ebe5ece688876bc986a8d89eb92d30d192e2ae5231bd94f56a7fe9ebda6ce672'
AND (
token = 'kmHelrY4yIFsY8/DcIn/xj4OkfmpeU7An87jJ1+jHSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)