UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PqRdACNE6bSMMhpa+3wenx6Yh4+NxP9bFtl/esDgKFI='
WHERE
key_id = 'c1b38f7ce6cfc3efa72f27a0a9b93cbc1e92c9b3e5e5e2a579350310f46d280f'
AND (
token = 'PqRdACNE6bSMMhpa+3wenx6Yh4+NxP9bFtl/esDgKFI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)