UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pR49NVGWefpZOO4mEDqNCizSPsn6GpH50BGn7wbOT+M='
WHERE
key_id = '52627f8ee2a1b831346544e5aec245014c324be6722ad3809ea76dbf156becf5'
AND (
token = 'pR49NVGWefpZOO4mEDqNCizSPsn6GpH50BGn7wbOT+M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)