UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qiqIu7VhF6UnswtjSdfqvT/Fj/J7EeoJoTA/BadI3V8='
WHERE
key_id = 'f5ab27f020767325ac952d67212cdde09c5bf0271628448d0163a77f627fd787'
AND (
token = 'qiqIu7VhF6UnswtjSdfqvT/Fj/J7EeoJoTA/BadI3V8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)