UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AcZj61imRBBAjA2EeKVXUyje0ui359G05CGJMSnh+vQ=' 
WHERE 
  key_id = 'a83c774c44ff0b22cf685a866c896807fe21b00b6188b1b34a5b7cd13dded56d' 
  AND (
    token = 'AcZj61imRBBAjA2EeKVXUyje0ui359G05CGJMSnh+vQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039