UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yeaGH9+uU628V7mSCywSTsKhZKte3YC2/BkqYqm0lj4=' 
WHERE 
  key_id = '4f95a52272c2015199eee80b475026aad9315363f2ce918f321a8d9b93f57605' 
  AND (
    token = 'yeaGH9+uU628V7mSCywSTsKhZKte3YC2/BkqYqm0lj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031