UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vRPknOmOCs+/5OL5FzuEAXOdC/rPbd4aNfLXLqlz390=' 
WHERE 
  key_id = '66640904f4f7fc4f2795f452d7cd80e32ec515a75143361003b6d16fb21ea8f7' 
  AND (
    token = 'vRPknOmOCs+/5OL5FzuEAXOdC/rPbd4aNfLXLqlz390=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047