UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'quLHucAz0mEI2SZE+QyuBQehS5hgrqp48jwd0A8Ei3o='
WHERE
key_id = 'a7a8fac9ceadf2067311277d1bca3c36f345fbbe2c2c16d96980c775e3a9563f'
AND (
token = 'quLHucAz0mEI2SZE+QyuBQehS5hgrqp48jwd0A8Ei3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)