UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gXesF10x70ks4lXuMYQknh4ctXZxTQfMEWCgjegq2FM=' 
WHERE 
  key_id = '14894a0f87d3bb4bfea5d16ab3e6abe6e38004a10e9fbd341f6fab3087b7ff5a' 
  AND (
    token = 'gXesF10x70ks4lXuMYQknh4ctXZxTQfMEWCgjegq2FM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030