UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DKtC10pEtqO8e0FeNjiKE+SXm5XzAFh8+oo1DLsFuVU=' 
WHERE 
  key_id = '18a66964db1f885d326685602ab5d4e09acaa8b76300033faea56a901fd2594b' 
  AND (
    token = 'DKtC10pEtqO8e0FeNjiKE+SXm5XzAFh8+oo1DLsFuVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035