UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IdhYtyE6ZjU4IrqCJj2GZnQILOzva2oS02CO9XPolb8='
WHERE
key_id = '813f0b564ca39f688f699c788f49a190eb1e980ce093a80a6d21ca41be7f54ca'
AND (
token = 'IdhYtyE6ZjU4IrqCJj2GZnQILOzva2oS02CO9XPolb8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)