UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HtP8haEwuXt99dS7sOdCXI2q2GwfLIX0vzpKa3spH3c=' 
WHERE 
  key_id = '00dac86b683a43701f946acc84d4c32d6996523ee565d0d93033af085aad3b7b' 
  AND (
    token = 'HtP8haEwuXt99dS7sOdCXI2q2GwfLIX0vzpKa3spH3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035