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