UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DegLIJ3DPFPSDiPVFAjMJbqicYbRySvIOrHMWN23x74='
WHERE
key_id = '3f0a2c10afe09a975728d4da7456d550edd9c6f19f6c3384d35810e14a07cc2b'
AND (
token = 'DegLIJ3DPFPSDiPVFAjMJbqicYbRySvIOrHMWN23x74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)