UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CkugbFbHG91MvPOkhnOquvrxHFScEEhLzRWdEBLhcc0='
WHERE
key_id = '840c45ae85e859c350bd2792f526379d1c067632487c8a73c89f741872842c9a'
AND (
token = 'CkugbFbHG91MvPOkhnOquvrxHFScEEhLzRWdEBLhcc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)