UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FV8OjE5cH0cqchoadPSahzug9k0+V7/KqPjTnM9Niis=' 
WHERE 
  key_id = '9d52d53ff1343d30569a72ae192d3a1768b8a5cc132e6c7eb3181b7123d5f3d3' 
  AND (
    token = 'FV8OjE5cH0cqchoadPSahzug9k0+V7/KqPjTnM9Niis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034