UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o75JXhA2kIn1e1hbWkG0PdltKRMjieWdaQrj1vg0wH0='
WHERE
key_id = 'c84c999412d7490a8dbcd649a69942fc5e934f47c8e6b87e306122a82f906a21'
AND (
token = 'o75JXhA2kIn1e1hbWkG0PdltKRMjieWdaQrj1vg0wH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)