UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jrGk2M2wQBJb6crSS54g1daDttJorUdmo2t5N97ma9w='
WHERE
key_id = '12b90f1b05faba293a1910a43b3cafec50e5517c6baaa9d60839a91e2531cc18'
AND (
token = 'jrGk2M2wQBJb6crSS54g1daDttJorUdmo2t5N97ma9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)