UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6JhXQZPiVJ/JWh8q6X3tqr4LaRQjz5LaaElp4KshEH8='
WHERE
key_id = '20f4a5ecb44a66a953824d75c41829ceb9b376b166c5e4dc44b2b43eb2571bac'
AND (
token = '6JhXQZPiVJ/JWh8q6X3tqr4LaRQjz5LaaElp4KshEH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)