UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ducgiKqJRoTl52xzI3Lw+5zUodZaEjWmhLqZ0XrbZ0w=' 
WHERE 
  key_id = '9ad9278699ae54e060cebdfb0859e1ef177887c1dd268eaa0be7ea5fcdea66e2' 
  AND (
    token = 'ducgiKqJRoTl52xzI3Lw+5zUodZaEjWmhLqZ0XrbZ0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046