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

Query time 0.00046