UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ipAQN6Uso7ajWCJNPK5/c10H2Dhm53TSi/xffmVM+dQ=' 
WHERE 
  key_id = '6c2fba7c7971e1c5495378964ee6359da82b8da4aca008d6b18a5b11c6798cd7' 
  AND (
    token = 'ipAQN6Uso7ajWCJNPK5/c10H2Dhm53TSi/xffmVM+dQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054