UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'umLrwBmEMNEaHzgydxqwhPA7vHqO8S8ssfsy79mthag=' 
WHERE 
  key_id = '02277f07043b3ef6339d77bf220f80c7db44ffd4a8b98408e999162f3395d1eb' 
  AND (
    token = 'umLrwBmEMNEaHzgydxqwhPA7vHqO8S8ssfsy79mthag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033