UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PryJ3Tpli7cwTiwS6z6k3UQIsAKdxX0uDlQN/BCW6Ns=' 
WHERE 
  key_id = '7392ef5114bd25f541e14d86c8acf452375753da24af58ec08c7392ee2ca0650' 
  AND (
    token = 'PryJ3Tpli7cwTiwS6z6k3UQIsAKdxX0uDlQN/BCW6Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046