UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'loWuNKy1BSR7mvwzyRttvQsP42Gew4XyHwFgGWt84kg=' 
WHERE 
  key_id = '345c67de5b683dbaaba2455a3437f0e9ad61e98d0c9882fd21d30d3c18302f3d' 
  AND (
    token = 'loWuNKy1BSR7mvwzyRttvQsP42Gew4XyHwFgGWt84kg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026