UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tzsVVfo9E/uxtbCRYYuRbdzIB7HxQ9AUhOYKjYZwVVY=' 
WHERE 
  key_id = '60f9a20da8d5cea78058e83121ac679a936e6d91948ce150c1bfa23081e71283' 
  AND (
    token = 'tzsVVfo9E/uxtbCRYYuRbdzIB7HxQ9AUhOYKjYZwVVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042