UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pCXyi8sUP7X9a0XOHmeosTfFpbP/oIbKNWRCaTWsQZs=' 
WHERE 
  key_id = '2fb5f845ab50866d4c94f7f40b9bb5846e47c4759f6391af8d9b34f173504815' 
  AND (
    token = 'pCXyi8sUP7X9a0XOHmeosTfFpbP/oIbKNWRCaTWsQZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021