UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5SQgKa1n1nEVTQlGbkIXhxXyW7rs+QpTayai1CKlTJU='
WHERE
key_id = 'ac56cad6aa68845c87b04ac90a5954629b341a8d6850a2576e17f92dfc5524b9'
AND (
token = '5SQgKa1n1nEVTQlGbkIXhxXyW7rs+QpTayai1CKlTJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)