UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XklqHV2MghqmzGkOEXSiL4bELnEjvYGcRJ35yhjgdSE='
WHERE
key_id = 'a241407d1a6e8c1323ae4e09f0c907b2f18ec568c8e3104e6409e9c35f0bdca4'
AND (
token = 'XklqHV2MghqmzGkOEXSiL4bELnEjvYGcRJ35yhjgdSE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)