UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uhgs7k3QmvZ3/2xLlmsFHaBkbiuPHks7qTRS1lKB6lc=' 
WHERE 
  key_id = '5e864ef2f41fe9b3fa7a5742d41afbd3c03fb59875d2cc14ad4c7fa01cdde4b5' 
  AND (
    token = 'Uhgs7k3QmvZ3/2xLlmsFHaBkbiuPHks7qTRS1lKB6lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050