UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KmEx7R9zTkfDe6q+VQVYIdml0Uab2wmO0jW8cmugRLM='
WHERE
key_id = 'e3740d1a161c97deb3147b944a78cefff97bb3f59cf4a2d28e864453de31159d'
AND (
token = 'KmEx7R9zTkfDe6q+VQVYIdml0Uab2wmO0jW8cmugRLM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)