UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8onlvwlf6d+IfOFLj8bSWnocW/7bkmAy3tNZcgODXK8='
WHERE
key_id = '27b418baa9f57bb456bb7292f9ac391025708c2817e9407798c6b8d46b5d9ba0'
AND (
token = '8onlvwlf6d+IfOFLj8bSWnocW/7bkmAy3tNZcgODXK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)