UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z6sQ7p2rV5SprvOP3ZLzxSrILhu+OoTHLp47KIzru00='
WHERE
key_id = 'e54f4bfef8ab48a51442959f5a85697198f28ae0d46a6ed44a390063c499ef88'
AND (
token = 'z6sQ7p2rV5SprvOP3ZLzxSrILhu+OoTHLp47KIzru00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)